/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.mallsite.modules.shop.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.mallsite.modules.shop.entity.Goods;
import com.mallsite.modules.shop.dao.GoodsDao;
import com.jeesite.modules.file.utils.FileUploadUtils;

/**
 * 商品Service
 * @author ruyang
 * @version 2020-12-04
 */
@Service
@Transactional(readOnly=true)
public class GoodsService extends CrudService<GoodsDao, Goods> {
	
	/**
	 * 获取单条数据
	 * @param goods
	 * @return
	 */
	@Override
	public Goods get(Goods goods) {
		return super.get(goods);
	}
	
	/**
	 * 查询分页数据
	 * @param page 分页对象
	 * @param goods
	 * @return
	 */
	@Override
	public Page<Goods> findPage(Page<Goods> page, Goods goods) {
		return super.findPage(page, goods);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param goods
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(Goods goods) {
		super.save(goods);
		// 保存上传图片
		FileUploadUtils.saveFileUpload(goods.getId(), "goods_image");
	}
	
	/**
	 * 更新状态
	 * @param goods
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(Goods goods) {
		super.updateStatus(goods);
	}
	
	/**
	 * 删除数据
	 * @param goods
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(Goods goods) {
		super.delete(goods);
	}
	
}